package com.sanpu.kxe.common.interfaces;

import android.text.TextUtils;

import com.sanpu.kxe.BuildConfig;
import com.sanpu.kxe.common.cache.CacheManage;
import com.sanpu.kxe.common.cache.CacheModel;

/**
 * Description：网络接口
 * Created by 薛勇军 on 2018/6/12.
 */

public class UrlConstants {

    /**
     * 生产环境
     */
//    public static final String BASE_URL = "http://kx2.kaypay.cn/";

    /**
     * 开发环境
     */
//    public static final String BASE_URL = "http://kxe.ngrok.alifepay.com:8380/";

    public static final String BASE_URL = "http://192.168.0.133:8980/";

    public static final int HTTP_TIMEOUT = 30;

    /**
     * 获取服务器地址
     *
     * @return 地址
     */
    public static String getBaseUrl() {
        if (BuildConfig.DEBUG) {
            String url = CacheManage.getInstance().getCache(CacheModel.URL_KEY);
            if (TextUtils.isEmpty(url)) {
                return BASE_URL;
            }
            return url;
        }
        return BASE_URL;
    }

    /**
     * 保存baseUrl
     */
    public static void setBaseUrl(String baseUrl) {
        if (BuildConfig.DEBUG) {
            CacheManage.getInstance().saveCache(CacheModel.URL_KEY, baseUrl);
        }
    }

    /**
     * 注册法律
     */
    public static final String LEGAL = getBaseUrl() + "app/page/registerLegal.html";

    /**
     * 使用帮助
     */
    public static final String USE_HELP = getBaseUrl() + "app/page/help/userHelp.html";

    /**
     * 代还帮助
     */
    public static final String REPAY_HELP = getBaseUrl() + "app/page/repay/repayHelp.html";

    /**
     * 操作手册
     */
    public static final String OPERATE_HELP = getBaseUrl() + "app/page/operate/operateHelp.html";

    /**
     * 会员详情帮助
     */
    public static final String MEMBER_HELP = getBaseUrl() + "app/help/memberDetails.html";
    public static final String MEMBER_BASEPROFIT = getBaseUrl() + "app/memberInfo/baseProfit.html?lvlId=";
    public static final String MEMBER_SCOREPROFIT = getBaseUrl() + "app/memberInfo/scoreProfit.html?lvlId=";
    public static final String MEMBER_REBPROFIT = getBaseUrl() + "app/memberInfo/rebProfit.html?lvlId=";
    public static final String MEMBER_FEEPROFIT = getBaseUrl() + "app/memberInfo/feeProfit.html?lvlId=";

    /**
     * 快捷银行卡限额
     */
    public static final String BANKS_LIMIT_HELP = getBaseUrl() + "app/help/banksLimitHelp.html";

    /**
     * 邀请注册
     */
    public static final String INVITE_REG = getBaseUrl() + "app/page/share/shareRegUI.html?referrer=";

    /**
     * 积分商城
     */
    public static final String LOGINDUIBA = getBaseUrl() + "app/useritcp/loginDuiba.html?";

    /**
     * 分享App
     */
    public static final String SHAREAPP = getBaseUrl() + "app/page/share/shareAppUI.html";

    public static final String PARTNER_NOTSIGN = getBaseUrl() + "app/page/partner/partnerNotSign.html";
    public static final String PARTNER_REMARK = getBaseUrl() + "app/page/partner/partnerRemark.html";
    public static final String REBTOPLISTV3 = getBaseUrl() + "app/useritcp/rebTopListV3.html";

    public static final String POSTER = getBaseUrl() + "app/useritcp/posterInfo.html";

    public static final String ALLYCOUNT = getBaseUrl() + "app/useritcp/allycount.html";

    public static final String QUICKWEBPAYMENT = getBaseUrl() + "app/useritcp/quickWebPayment.html";

    /**
     * 快捷H5
     */
    public static final String URL_QUICKPAYH5 = getBaseUrl() + "app/client/pay/quickPayH5.html";

    /**
     * 绑信用卡
     */
    public static final String URL_BINDCARD = getBaseUrl() + "app/client/repay/bindCard.html";

    public static final String BILLMONTHCOUNT = getBaseUrl() + "app/useritcp/billmonthcount.html?";

    /**
     * 办理信用卡
     */
    public static final String URL_TRANSACT_CARD = getBaseUrl() + "app/page/credit/creditCardCenter.html";

    /**
     * 贷款
     */
    public static final String URL_LOANS = getBaseUrl() + "app/page/loans/theLoan.html";

    /**
     * 商品详情分享
     */
    public static final String SHOPGOODSDETAILSHAREUI = getBaseUrl() + "app/page/shop/shopGoodsDetailShareUI.html?goodsId=";

    /**
     * 了难中心
     */
    public static final String SOLVEDIFFICULTY = getBaseUrl() + "app/page/task/solveDifficulty.html";
    public static final String kEY_SOLVEDIFFICULTY = "app/page/task/solveDifficulty.html";

    /**
     * 费率优惠
     */
    public static final String feeDiscountUrl = getBaseUrl() + "app/page/fee/feeDiscount.html";

    /**
     * 推广协议地址
     */
    public static final String URL_UPGRADE_AGREEMENT = getBaseUrl() + "app/page/upgradeAgreement.html";
}